<script setup lang="ts">
import { ref } from 'vue'
import NavBar from './components/NavBar.vue'

const isCollapse = ref(false)

const handleCollapse = (collapsed: boolean) => {
  isCollapse.value = collapsed
}
</script>

<template>
  <div class="app-container">
    <NavBar 
      :is-collapse="isCollapse" 
      @collapse="handleCollapse"
    />
    <div class="main-container" :class="{ 'is-collapsed': isCollapse }">
      <!-- <div class="header">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item>首页</el-breadcrumb-item>
          <el-breadcrumb-item>告警管理</el-breadcrumb-item>
        </el-breadcrumb>
      </div> -->
      <div class="content">
        <router-view />
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  overflow-x: hidden;
  
  .main-container {
    flex: 1;
    margin-left: 240px;
    transition: margin-left 0.3s;
    display: flex;
    flex-direction: column;
    width: calc(100% - 240px);
    
    &.is-collapsed {
      margin-left: 64px;
      width: calc(100% - 64px);
    }
    
    .header {
      height: 60px;
      background-color: #fff;
      border-bottom: 1px solid #dcdfe6;
      padding: 0 20px;
      display: flex;
      align-items: center;
      box-shadow: 0 1px 4px rgba(0,21,41,.08);
    }
    
    .content {
      padding: 20px;
      background-color: #f0f2f5;
      min-height: 100%;
    }
  }
}
</style>
